package com.guguskins.back.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * 
 * </p>
 *
 * @author mybatis-plus
 * @since 2021-07-02
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("gu_market")
public class GuMarket extends Model<GuMarket> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = "market_id", type = IdType.AUTO)
    private Long marketId;

    /**
     * 1 box 2 goods 3 prop
     */
    private Integer marketItemType;

    /**
     * 奖品id
     */
    private Long marketItemId;

    /**
     * 兑换鸡蛋类型
     */
    private Integer marketPropType;

    /**
     * 兑换所需鸡蛋数量
     */
    @Min(value = 1, message = "价钱至少1.00")
    private BigDecimal marketPrice;

    /**
     * 0 下架 1 上架
     */
    private Integer marketState;

    /**
     * 数量
     */
    private Integer marketNumber;

    /**
     * 排序（越小越靠前）
     */
    private Integer marketSort;

    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime marketCreateTime;

    /**
     * 更新时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime marketUpdateTime;


    @Override
    protected Serializable pkVal() {
        return this.marketId;
    }

}
